<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>可接受任务车辆列表</title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/jquery/jquery-ui-1.8.23.custom.css" media="screen">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/ztree/zTreeStyle.css" media="screen">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/form/jquery.mrd.form.css" media="screen">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/jquery/jquery-ui-timepicker-addon.css" media="screen">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/validata/validationEngine.jquery.css" media="screen">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/layout/layout-default-latest.css" media="screen">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/jqgrid/ui.jqgrid.css" media="screen">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/jw/jw.css" media="screen">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/multiselect/jquery.multiselect.css" media="screen">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/main.css" media="screen">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/global.css" media="screen">
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery/jquery-ui-1.8.23.custom.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery/i18n/jquery.ui.datepicker-zh-CN.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery/i18n/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/ztree/jquery.ztree.all-3.4.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/form/jquery.form.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/validata/jquery.validationEngine-zh_CN.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/validata/jquery.validationEngine.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/layout/jquery.layout-latest.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jqgrid/i18n/grid.locale-cn.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jqgrid/jquery.jqGrid.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jw/jw.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/form/jquery.mrd.form.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/util.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/multiselect/jquery.multiselect.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/global.js"></script>
<script type="text/javascript">
var guestListUrl = "<%=request.getContextPath()%>/guestShortName.json?ftype=T";
var guestDownData = $.mrdForm.ajaxdp(guestListUrl);
	var formSetting = {
			title : "预配车辆评分查询",
			module : 'query',
			columns : [{
				index : "COMPANY_ID",
				name : "COMPANY_ID",
				label : "车队",
				value:"${companyId}",
				type:"dropdown",
				dropdownType:"ajax",
				url : guestListUrl,
				data : guestDownData,
				op:"eq",
				minLength:0
			},{
					index : "VEHICLE_ID",
					name : "VEHICLE_NUM",
					label : "车牌号码",
					op:"eq",
					minLength:0
				}],
		grid : {
			id : "DataGrid",
			title : "查询结果",
			url : "findVehicleList.json",
			dataType : "application/json",
			rownumbers:true,
			colModel : [{
				index : "ID",
				name : "id",
				hidden : true
			},{
				index : "VEHICLE_COMPANYID",
				name : "companyId",
				label:"车队",
				formatter : function(cellvalue, options, rowObject) {
					var chn_name = "";
					for(var i = 0;i < guestDownData.length;i++){
						if(guestDownData[i][1] == cellvalue){
							chn_name = guestDownData[i][0];
						}
					}
					return chn_name;
				}
			},{
				index : "VEHICLE_NAME",
				name : "vehicleNum",
				label : " 车牌号码",
				formatter : function(cellvalue, options, rowObject) {
					var url  = "";
					if(cellvalue){
						url = "<a href=\"javascript:doGetVehicleInfoDetail('"+cellvalue+"')\">"+cellvalue+"</a>";
						return url;
					}
				}
			},{
				index : "CODE_NAME",
				name : "codeName",
				label : "约束项",
				width : 180
			},{
				index : "BACK_TIME",
				name : "vehicleRequest.backTime",
				label : "回场日期",
				align : "center",
				formatter : function(cellvalue, options, rowObject) {
					if(cellvalue){
						var date = cellvalue.substring(10,0);
						return date;
					}
				}
			},{
				index : "BACK_TURNS",
				name : "vehicleRequest.backTurns",
				label : "回场轮次",
				align : "center",
				width : 60
			}],
			sortname: "",
			sortorder: "",
			jsonReader : {
				root : "dataRecord.beans",
				page : "dataRecord.page.page",
				total : "dataRecord.page.totlePage",
				records : "dataRecord.page.recordCount",
				repeatitems : false
			}
		}
	};
	$(document).ready(function() {
		$("#DataTable").mrdForm(formSetting);
	});
	function doGetVehicleInfoDetail(vehicle_no){
		var records = $("#DataGrid").getGridParam("reccount");//行数
		var rowIds = $("#DataGrid").getDataIDs();//所有ID号
		for(var i = 0;i < records;i++){
			var dataVehicleNo = $("#DataGrid").getCell(rowIds[i],"vehicleNum");
			if(dataVehicleNo.indexOf(vehicle_no) > 0){
				var id = $("#DataGrid").getCell(rowIds[i],"id");	
				var url = "../../vehicle/vehicleInfoDetail.html?id="+id;
				jw.dialog({iframe:url,title:'车辆信息明细',iframeFetchTitle:false,width:800,height:500});
			}   
		}
	}
</script>
</head>
<body>
	<div id="DataTable"></div>
</body>
</html>